/*-----------------------------------------------------------------------------
 * stock_server_stream.h - Header for stream based server routines and data
 *                         structures
 *
 * March 2010, Forhad Ahmed
 *-----------------------------------------------------------------------------
 */

#ifndef _STOCK_SERVER_STREAM_
#define _STOCK_SERVER_STREAM_

#include "avl_tree.h"
#include "common/include/stock_update.h"

#define STOCK_MAX_STREAM_CLIENTS 16


typedef struct stock_stream_stats_t {
    int accepted;
    int accept_failed;
    int rejected;
    int client_closed;
} stock_stream_stats_t;

typedef struct stock_stream_clientinfo_t {
    avl_node    avl;
    in_addr_t   client_addr;
 
} stock_stream_clientinfo;

extern stock_stream_stats_t  stock_server_stream_stats;
extern avl_tree             *stock_server_stream_clients;

void
stock_server_stream(int sock);

#endif /* _STOCK_SERVER_STREAM_ */
